//
//  BOSBaseViewController.m
//  LeftDemo
//
//  Created by bosma on 14-4-15.
//  Copyright (c) 2014年 cn.com.bosma. All rights reserved.
//

#import "BOSBaseViewController.h"
#import "BOSFrontViewController.h"
#import "SWRevealViewController.h"
#import "BOSLeftViewController.h"
#import "BOSRightViewController.h"
#import "BOSSwipeController.h"

@interface BOSBaseViewController ()

@end

@implementation BOSBaseViewController
@synthesize swipeController;
@synthesize leftView;
@synthesize rightView;
@synthesize frontView;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
	[super viewDidLoad];
	//标题
	self.title = NSLocalizedString(@"首页", nil);
    //实例化对象
    SWRevealViewController *revealController = [self revealViewController];
    //点击手势
    [self.navigationController.navigationBar addGestureRecognizer:revealController.panGestureRecognizer];
    //点击事件
    UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
                                                                         style:UIBarButtonItemStyleBordered target:revealController action:@selector(revealToggle:)];
    //设置导航栏左侧按钮
    self.navigationItem.leftBarButtonItem = revealButtonItem;
    
    self.swipeController = [[BOSSwipeController alloc] init] ;
    
    [self reloadViewControllers];
    
    self.navigationController.viewControllers = [NSArray arrayWithObject:self.swipeController];
}



- (void)reloadViewControllers
{

    frontView = [[BOSFrontViewController alloc]init];
    frontView.navigationItem.title = @"ViewController 1";
    
    leftView = [[BOSLeftViewController alloc] init] ;
    leftView.navigationItem.title = @"ViewController 2";
    
    rightView = [[BOSRightViewController alloc] init] ;
    rightView.navigationItem.title = @"ViewController 3";
    
    self.swipeController.viewControllers = [NSArray arrayWithObjects:
                                            frontView,
                                            leftView,
                                            rightView, nil];
}


@end
